﻿@model PublishNews.Models.LoginViewModel

@{
    ViewBag.Title = "Log in";
    Layout = "~/Views/Shared/_Landing.cshtml";
}

<div class="row">
    <div class="alert alert-info">
        <a class="close" data-dismiss="alert" href="#">&times;</a>
        Press enter key or click the Log in button
    </div>
    @using (Html.BeginForm("Login", "Home", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "bootstrap-admin-login-form" }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)
        <h1>Login</h1>
        <div class="form-group">
            @Html.TextBoxFor(m => m.UserName, new { @class = "form-control", placeholder = "UserName" })
            @Html.ValidationMessageFor(m => m.UserName)
        </div>
        <div class="form-group">
            @Html.PasswordFor(m => m.Password,new { @class = "form-control", placeholder = "Password" })
            @Html.ValidationMessageFor(m => m.Password)
        </div>
        <div class="form-group">
        </div>
        <div class="form-group">
            <label>
                @Html.CheckBoxFor(m => m.RememberMe)
                Remember me
            </label>
        </div>
        <button class="btn btn-lg btn-primary" type="submit">Log in</button>
    }
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script type="text/javascript">
        $(function () {
            // Setting focus
            $('input[name="UserName"]').focus();
            // Setting width of the alert box
            var formWidth = $('.bootstrap-admin-login-form').innerWidth();
            var alertPadding = parseInt($('.alert').css('padding'));
            $('.alert').width(formWidth - 2 * alertPadding);
        });
    </script>
}
